<?php
include("includes/class_db.php");
$db = new \db\database();
$config = array();

include("includes/class_config.php");
$config["base"] = new \config\config();

include("includes/class_categoria.php");
include("includes/class_secciones.php");
include("includes/class_imagenes.php");
include("includes/class_upload.php");
include("includes/class_dato.php");
include("includes/class_info.php");
include("includes/functions.php");

$oEscenografia = new \seccion\secciones($config["idEscenografia"]);
$oVestuario = new \seccion\secciones($config["idVestuario"]);


if (!isset($_POST["request"]))
    die();


$request = $_POST["request"];


if ($request == "imgInfo"){

    if (isset($_POST["imgId"]) and $_POST["imgId"] != 0){
        $sSql = "SELECT img . * , s.path FROM  `imagenes` img LEFT JOIN  `secciones` s ON img.idseccion  = s.id where img.id = " . $_POST["imgId"];

        $res = $db->execSql($sSql);
        if ($res){
            echo query2Json($res);
        }
    }
}

function query2Json($res){
    $rows = array();
    while($r = mysqli_fetch_assoc($res)) {
        $rows[] = $r;
    }
    return json_encode($rows);
}
?>